<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>我的银行卡</title>
  <link rel="stylesheet" href="../static/framework/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="../static/framework/reset.css">
  <link rel="stylesheet" href="../static/css/footer.css">
  <link rel="stylesheet" href="../static/css/editRecipient.css">
  <link href="../static/layui-v2.9.1/layui/css/layui.css" rel="stylesheet">
  <script src="../static/layui-v2.9.1/layui/layui.js"></script>
  <link rel="stylesheet" href="../static/bootstrap-5.3.0-dist/css/bootstrap.min.css">
  <script src="../static/bootstrap-5.3.0-dist/js/bootstrap.bundle.min.js"></script>
  <link rel="stylesheet" href="../static/css/recipientList.css">
  <style>
    .card {
      border-radius: 10px;
      background: hsl(168, 65%, 60%);
      box-shadow: 20px 20px 60px hsl(0, 0%, 70%), -20px -20px 60px #ffffff;
      border: 2px solid hsl(0, 0%, 82%);
      font-family: Arial, sans-serif;
      color: white;
      /* 白色字体 */
    }

    #myForm {
      padding: 20px;
      max-width: 400px;
      margin: auto;
    }

    #myForm h2 {
      text-align: center;
      margin-bottom: 20px;
    }

    #myForm form {
      display: flex;
      flex-direction: column;
      gap: 15px;
    }

    #myForm input[type="text"],
    #myForm input[type="password"] {
      padding: 10px;
      font-size: 16px;
      border: 1px solid #ccc;
      border-radius: 5px;
    }

    #myForm button[type="submit"] {
      padding: 10px;
      font-size: 16px;
      color: #fff;
      background-color: #007bff;
      border: none;
      border-radius: 5px;
      cursor: pointer;
    }
    .card {
      margin-bottom: 20px;
      border-width: 2px; /* 调整边框宽度 */
      border-radius: 8px;
      transition: all 0.3s ease-in-out; /* 添加过渡效果 */
    }
    .card-title {
      color: #007bff; /* 设置标题颜色 */
      font-weight: bold;
      display: flex;
      justify-content:center ;
    }
    .card-text {
      color: #6c757d; /* 设置文本颜色 */
      display: flex;
      justify-content:center ;
    }
    .border-danger {
      border-color: red; /* 设置冻结卡片的边框颜色 */
    }
  </style>
</head>

<body>
  <div class="wrapper" style="padding: 20px;">
    <header>
      <i class="fa fa-angle-left fa-2x" onclick="location.href='/index'" style="font-size: 20px">首页</i>
      <p style="margin: auto;">银行卡管理</p>
      <p class="addCard" style="cursor: pointer;margin-top:20px;" lay-on="test-page">添加</p>
    </header>

    <br><br>
    <div th:each="card : ${session.cards}">
      <div class="card" th:if="${card.statusId} != 3 and ${card.statusId} != 4 and ${card.statusId} != 5">
        <div class="card-body">
          <h5 class="card-title">中国农业银行</h5>
          <p class="card-text" th:text="(${card.cardType} == 1)? '借记卡' : '信用卡'">储蓄卡</p>
          <h5 th:text="${card.idNumber}" style=" display:flex; justify-content: center">12位卡号</h5>
          <div class="card-text" th:text="'余额：' + ${card.balance}">余额</div>
          <div th:switch="${card.statusId}" style=" display:flex; justify-content: center">
              <div th:case="1" th:text="正常" ></div>
              <div style="color: red" th:case="2" th:text="冻结" ></div>
          </div>

          <form action="/cardSet" method="get" style=" display:flex; justify-content: center">
            <input type="hidden" id="catdId" name="cardId" th:value="${card.idNumber}">
            <button type="submit" class="btn btn-primary">挂失</button>
          </form>

        </div>
      </div>
    </div>
    <br>
    <br>
    <br>



    <footer class="footer">
      <div>
        <button type="button" class="layui-btn">
          <i class="layui-icon layui-icon-left"></i>
        </button>
        <button type="button" class="layui-btn">
          <i class="layui-icon layui-icon-right"></i>
        </button>
      </div>
    </footer>

  </div>
  <script>
    const back = document.querySelector('button:first-child')
    const forword = back.nextElementSibling
    back.addEventListener('click', function () {
      //history.back()
      history.go(-1)
    })

    forword.addEventListener('click', function () {
      //history.forward()
      history.go(1)
    })
    layui.use(function () {
      var $ = layui.$;
      var layer = layui.layer;
      var util = layui.util;
      var form = layui.form;
      // 事件
      util.on('lay-on', {
        'test-page': function () {
          layer.open({
            type: 1,
            area: ['350px', 'auto'], // 宽高，根据需要调整
            content: `
            <div id="myForm">
            <h2>绑定银行卡</h2>
            <form action="/card/updateuserId" method="post">
              <input type="text" name="idNumber" placeholder="卡号">
              <input type="password" name="password" placeholder="密码">
              <button type="submit">提交</button>
            </form>
            </div>
      `
          });
        }
      });
    })

  </script>
</body>

</html>